<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // function student(name) {
    //     this.name = name;
    // }
    //ES6之后
    class Student{
        constructor(name) {
            this.name = name;
        }
        hello(){
            alert("hello");
        }
    }
    class xiaoStudent extends Student{
        constructor(name, grade) {
            super(name);
            this.grade = grade;
        }
        myGrade(){
            alert("我是一名"+ this.grade +"年级小学生")
        }
    }
    var xiaoming = new Student("xiaoming");
    var xiaohong = new xiaoStudent("xiaohong", 3);
</script>
</body>
</html>